package se.robertfoss.ChanImageBrowser.Fetcher;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import android.util.Log;


public abstract class HTMLFetcher extends Thread{
	/** Called when the activity is first created. */
	
	public static String getUrlContent(String sUrl) throws IOException{
		URL url = new URL(sUrl);
		URLConnection connection = url.openConnection();
		InputStream urlIS = connection.getInputStream();
		BufferedReader rd = new BufferedReader(new InputStreamReader(urlIS));
		String line;
		StringBuilder content = new StringBuilder(2048);
		try {
			while ((line = rd.readLine()) != null) {
				content.append(line + "\n");
			}
		} catch (IOException e) {
			Log.d("NetworkData", "Couldnt read from: " + sUrl);
			e.printStackTrace();
		}
		return content.toString();
	}

}